import java.util.*;

public class Test20 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String s = in.nextLine();
            int left = 0, right = s.length()-1;
            while (left < right) {
                if (s.charAt(left) == s.charAt(right) && isHui(s, left, right)) {
                    left++;
                    right--;
                }else{
                    break;
                }
            }
            System.out.println(right - left + 1);
        }
    }

    public static boolean isHui(String s, int left, int right) {
        while (left <= right) {
            if (s.charAt(left) == s.charAt(right)) {
                left++;
                right--;
            } else {
                return false;
            }
        }
        return true;
    }








    public static void main02(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;i++){
                arr[i]=in.nextInt();
            }
            int left=0,right=0;
            int[] max=new int[n];
            int i=0;
            int sum=0;
            int cur=-1;
            while(right<n){
                if(arr[right] <0){
                    cur=right;
                }
                sum+=arr[right];
                if(sum < 0){
                    max[i++]=sum-arr[right];
                    sum=0;
                    left=cur+1;
                }
                right++;
            }
            max[i]=sum;
            int Max=0;
            for(int x:max){
                Max=Math.max(Max,x);
            }
            System.out.println(Max);
        }
    }










    public static void main01(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLong()) { // 注意 while 处理多个 case
            long a = in.nextLong();
            long h = in.nextLong();
            long b = in.nextLong();
            long k = in.nextLong();
            long i=h/b;
            long j=k/a;
            if(i == j){
                System.out.println((a+b)*(i+1));
            }else if(i>j){
                System.out.println((a+b)*(j+1)+10*a);
            }else{
                System.out.println((a+b)*(i+1)+10*b);
            }
        }
    }
}
